<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="css/mui.min.css" />
<link rel="stylesheet" href="css/app.css" />
</head>
<body class="of-hidden">
    <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 id="title" class="mui-title">标题</h1>
    </header>
    <script src="js/mui.min.js"></script>
    <script src="js/app.js"></script>
    <script type="text/javascript">
        (function($, doc) {
            var sh = 0; // status bar height
            app.immersion(function (h) {
                sh = h;
                doc.querySelector('header').classList.add('immersion');
            });
            $.init({
                subpages: [{
                    id: 'normal',
                    url: 'normal.html',
                    styles: {
                        top: (sh + 44) + 'px',
                        bottom: '0px'
                    },
                    errorPage: '_www/404.html'
                }],
                beforeback: function () {
                    setTimeout(function() {
                        loadUrl(null, 'normal.html');
                    }, 200);
                    return true;
                }
            });
            var plusReady = false;
            $.plusReady(function() {
                plusReady = typeof plus != 'undefined';
            });

            function loadUrl(title, url) {
                doc.querySelector('h1').innerText = title || '';
                var web = plus.webview.getWebviewById('normal');
                if (web) {
                    web.loadURL(url);
                    web.show();
                } else {
                    console.log("webview normal 不存在");
                }
            }
            window.addEventListener('show', function(e) {
                loadUrl(e.detail.title, decodeURIComponent(e.detail.url));
            }, false);
        })(mui, document);
    </script>
</body>
</html>